using BLL;
using DAL;
using IBLL;
using IDAL;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(s =>
{
    var path = AppDomain.CurrentDomain.BaseDirectory + "RK0217.xml";
    s.IncludeXmlComments(path);

});

builder.Services.AddDbContext<MyContext>(x =>
{
    x.UseSqlServer(builder.Configuration.GetConnectionString("con"));
});
builder.Services.AddScoped(typeof(IBase<>),typeof(Base<>));
builder.Services.AddScoped<IMemberBLL,MemberBLL>();
builder.Services.AddScoped<INumBLL,NumBLL>();

var app = builder.Build();
app.UseCors(x=>x.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
